#include<bits/stdc++.h>
using namespace std;

int main(){
    int n,x,maxn = -1,minn = 101;
    cin >> n;
    for(int i = 1; i <= n; i++){
        cin >> x;
        if(x > maxn){
            maxn = x;
        }
        if(x < minn){
            minn = x;
        }
    }
    cout << maxn - minn;
    return 0;
}